< previous page page_353 next page >

Page 353
SelStart
SelLength
SelText
SelBold
SelColor
SelFontSize
SelFontName
SelColor
SelTabCount
SelTabs
The SelStart property, in conjunction with SelLength and SelText, allows you to format a specified sequence of characters or words in the control. These properties are ideal for visually setting apart the header columns from the remainder of the information in your Rich Text Box. SelStart specifies the starting position, SelLength specifies the length of the text you want selected, and SelText represents the actual text in your selection. Thus, given a string variable, sHeading, that contained the column headings for the top row of your Rich Text Box control, the property settings might look like Listing 16.1.
LISTING 16.1. VISUALLY SETTING APART HEADER COLUMNS IN A RICH TEXT BOX.

9f8044bafea36a1f728739c0bb58ef4c.gif
1: With theRichTextBox
2:    SelStart = 0
3:    SelLength = Len(sHeading)
4:    MsgBox .SelText
5:    SelBold = True
6:    SelColor = vbBlue
7:    SelFontSize = 18
8:    SelFontName = Times New Roman
9: End With

Notice the introduction of the properties, SelBold, SelColor, SelFontSize, and SelFontName. The property names are self-explanatory. SelBold makes the selected text bold. SelColor sets the selected color to whatever you specify. SelFontSize and SelFontName, respectively, change the size and name of the font the selected text has as attributes.
The SelTabCount property tells the Rich Text Box how many tab positions to put in the control. For as many tab positions you place in the control, the control has a collection of these tabs encapsulated in the SelTabs property.
Other helpful properties include the SelBullet property, which inserts a bullet at the beginning of the selected text. The SelItalic, SelStrikethru, and SelUnderline properties, like the SelBold property, change how the selected text appears to the user.

 
< previous page page_353 next page >

If you like this book, buy it!